package com.yjt.common.entity;

import com.google.common.collect.Lists;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

@Data
@ApiModel(value = "树形节点")
public class TreeNode implements Serializable {

    private static final long serialVersionUID =1L;

    @ApiModelProperty(value = "子节点列表")
    protected List<TreeNode> children = Lists.newArrayList();

    @ApiModelProperty(value = "当前节点id",hidden = true)
    protected String id;

    @ApiModelProperty(value = "父节点id")
    protected String parentId;

    public void add(TreeNode node) {
        children.add(node);
    }
}
